<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Bind</title>
</head>
<body>
	Bind实现
</body>
<script>
	Function.prototype.mybind = function() {
		var _this = this;
		var context = [].shift.call(arguments);// 保存需要绑定的this上下文
		var args = [].slice.call(arguments); //剩下参数转为数组
		return function() {
			return _this.apply(context, [].concat.call(args, [].slice.call(arguments)));
		}
	};
	function test() {
		console.log('arguments', arguments)
	}
	var obj = {name:12}
	test.mybind(obj, 3, 2, 1)(6)
</script>
</html>